import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 移除 DataV-Vue3 相关导入，我们将使用 ECharts 和 Element Plus 构建大屏
import App from './App.vue'
import router from './router'
// 导入全局样式
import './assets/styles/global.css'
// 导入图标样式
import './assets/styles/icons.css'
// 导入自定义图标组件
import Icons from './components/icons'

// 引入ECharts核心模块
import * as echarts from 'echarts/core'
// 引入图表类型
import { BarChart, LineChart, PieChart, GaugeChart } from 'echarts/charts'
// 引入提示框、标题、直角坐标系、数据集、内置数据转换器组件
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  LegendComponent
} from 'echarts/components'
// 引入标签布局、环形布局相关组件
import { LabelLayout, UniversalTransition } from 'echarts/features'
// 引入Canvas渲染器
import { CanvasRenderer } from 'echarts/renderers'

const app = createApp(App)

// 注册必须的组件
echarts.use([
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  LegendComponent,
  BarChart,
  LineChart,
  PieChart,
  GaugeChart,
  LabelLayout,
  UniversalTransition,
  CanvasRenderer
])

// 将echarts挂载到全局
app.config.globalProperties.$echarts = echarts

app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(Icons) // 注册自定义图标组件

app.mount('#app')
